home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / rogue / rogue.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-05-13  |  9.8 KB  |  440 lines

  1. /*
  2.  * object.h
  3.  *
  4.  * This source herein may be modified and/or distributed by anybody who
  5.  * so desires, with the following restrictions:
  6.  *    1.)  This notice shall not be removed.
  7.  *    2.)  Credit shall not be taken for the creation of this source.
  8.  *    3.)  This code is not to be traded, sold, or used for personal
  9.  *         gain or profit.
  10.  *
  11.  */
  12.  
  13. #define boolean char
  14.  
  15. #define NOTHING        ((unsigned short)     0)
  16. #define OBJECT        ((unsigned short)    01)
  17. #define MONSTER        ((unsigned short)    02)
  18. #define STAIRS        ((unsigned short)    04)
  19. #define HORWALL        ((unsigned short)   010)
  20. #define VERTWALL    ((unsigned short)   020)
  21. #define DOOR        ((unsigned short)   040)
  22. #define FLOOR        ((unsigned short)  0100)
  23. #define TUNNEL        ((unsigned short)  0200)
  24. #define TRAP        ((unsigned short)  0400)
  25. #define HIDDEN        ((unsigned short) 01000)
  26.  
  27. #define ARMOR        ((unsigned short)   01)
  28. #define WEAPON        ((unsigned short)   02)
  29. #define SCROLL        ((unsigned short)   04)
  30. #define POTION        ((unsigned short)  010)
  31. #define GOLD        ((unsigned short)  020)
  32. #define FOOD        ((unsigned short)  040)
  33. #define WAND        ((unsigned short) 0100)
  34. #define RING        ((unsigned short) 0200)
  35. #define AMULET        ((unsigned short) 0400)
  36. #define ALL_OBJECTS    ((unsigned short) 0777)
  37.  
  38. #define LEATHER 0
  39. #define RINGMAIL 1
  40. #define SCALE 2
  41. #define CHAIN 3
  42. #define BANDED 4
  43. #define SPLINT 5
  44. #define PLATE 6
  45. #define ARMORS 7
  46.  
  47. #define BOW 0
  48. #define DART 1
  49. #define ARROW 2
  50. #define DAGGER 3
  51. #define SHURIKEN 4
  52. #define MACE 5
  53. #define LONG_SWORD 6
  54. #define TWO_HANDED_SWORD 7
  55. #define WEAPONS 8
  56.  
  57. #define MAX_PACK_COUNT 24
  58.  
  59. #define PROTECT_ARMOR 0
  60. #define HOLD_MONSTER 1
  61. #define ENCH_WEAPON 2
  62. #define ENCH_ARMOR 3
  63. #define IDENTIFY 4
  64. #define TELEPORT 5
  65. #define SLEEP 6
  66. #define SCARE_MONSTER 7
  67. #define REMOVE_CURSE 8
  68. #define CREATE_MONSTER 9
  69. #define AGGRAVATE_MONSTER 10
  70. #define MAGIC_MAPPING 11
  71. #define SCROLLS 12
  72.  
  73. #define INCREASE_STRENGTH 0
  74. #define RESTORE_STRENGTH 1
  75. #define HEALING 2
  76. #define EXTRA_HEALING 3
  77. #define POISON 4
  78. #define RAISE_LEVEL 5
  79. #define BLINDNESS 6
  80. #define HALLUCINATION 7
  81. #define DETECT_MONSTER 8
  82. #define DETECT_OBJECTS 9
  83. #define CONFUSION 10
  84. #define LEVITATION 11
  85. #define HASTE_SELF 12
  86. #define SEE_INVISIBLE 13
  87. #define POTIONS 14
  88.  
  89. #define TELE_AWAY 0
  90. #define SLOW_MONSTER 1
  91. #define CONFUSE_MONSTER 2
  92. #define INVISIBILITY 3
  93. #define POLYMORPH 4
  94. #define HASTE_MONSTER 5
  95. #define PUT_TO_SLEEP 6
  96. #define MAGIC_MISSILE 7
  97. #define CANCELLATION 8
  98. #define DO_NOTHING 9
  99. #define WANDS 10
  100.  
  101. #define STEALTH 0
  102. #define R_TELEPORT 1
  103. #define REGENERATION 2
  104. #define SLOW_DIGEST 3
  105. #define ADD_STRENGTH 4
  106. #define SUSTAIN_STRENGTH 5
  107. #define DEXTERITY 6
  108. #define ADORNMENT 7
  109. #define R_SEE_INVISIBLE 8
  110. #define MAINTAIN_ARMOR 9
  111. #define SEARCHING 10
  112. #define RINGS 11
  113.  
  114. #define RATION 0
  115. #define FRUIT 1
  116.  
  117. #define NOT_USED        ((unsigned short)   0)
  118. #define BEING_WIELDED    ((unsigned short)  01)
  119. #define BEING_WORN        ((unsigned short)  02)
  120. #define ON_LEFT_HAND    ((unsigned short)  04)
  121. #define ON_RIGHT_HAND    ((unsigned short) 010)
  122. #define ON_EITHER_HAND    ((unsigned short) 014)
  123. #define BEING_USED        ((unsigned short) 017)
  124.  
  125. #define NO_TRAP -1
  126. #define TRAP_DOOR 0
  127. #define BEAR_TRAP 1
  128. #define TELE_TRAP 2
  129. #define DART_TRAP 3
  130. #define SLEEPING_GAS_TRAP 4
  131. #define RUST_TRAP 5
  132. #define TRAPS 6
  133.  
  134. #define STEALTH_FACTOR 3
  135. #define R_TELE_PERCENT 8
  136.  
  137. #define UNIDENTIFIED ((unsigned short) 00)    /* MUST BE ZERO! */
  138. #define IDENTIFIED ((unsigned short) 01)
  139. #define CALLED ((unsigned short) 02)
  140.  
  141. #define DROWS 24
  142. #define DCOLS 80
  143. #define MAX_TITLE_LENGTH 30
  144. #define MORE "-more-"
  145. #define MAXSYLLABLES 40
  146. #define MAX_METAL 14
  147. #define WAND_MATERIALS 30
  148. #define GEMS 14
  149.  
  150. #define GOLD_PERCENT 46
  151.  
  152. struct id {
  153.     short value;
  154.     char *title;
  155.     char *real;
  156.     unsigned short id_status;
  157. };
  158.  
  159. /* The following #defines provide more meaningful names for some of the
  160.  * struct object fields that are used for monsters.  This, since each monster
  161.  * and object (scrolls, potions, etc) are represented by a struct object.
  162.  * Ideally, this should be handled by some kind of union structure.
  163.  */
  164.  
  165. #define m_damage damage
  166. #define hp_to_kill quantity
  167. #define m_char ichar
  168. #define first_level is_protected
  169. #define last_level is_cursed
  170. #define m_hit_chance class
  171. #define stationary_damage identified
  172. #define drop_percent which_kind
  173. #define trail_char d_enchant
  174. #define slowed_toggle quiver
  175. #define moves_confused hit_enchant
  176. #define nap_length picked_up
  177. #define disguise what_is
  178. #define next_monster next_object
  179.  
  180. struct obj {                /* comment is monster meaning */
  181.     unsigned long m_flags;    /* monster flags */
  182.     char *damage;            /* damage it does */
  183.     short quantity;            /* hit points to kill */
  184.     short ichar;            /* 'A' is for aquatar */
  185.     short kill_exp;            /* exp for killing it */
  186.     short is_protected;        /* level starts */
  187.     short is_cursed;        /* level ends */
  188.     short class;            /* chance of hitting you */
  189.     short identified;        /* 'F' damage, 1,2,3... */
  190.     unsigned short which_kind; /* item carry/drop % */
  191.     short o_row, o_col, o;    /* o is how many times stuck at o_row, o_col */
  192.     short row, col;            /* current row, col */
  193.     short d_enchant;        /* room char when detect_monster */
  194.     short quiver;            /* monster slowed toggle */
  195.     short trow, tcol;        /* target row, col */
  196.     short hit_enchant;        /* how many moves is confused */
  197.     unsigned short what_is;    /* imitator's charactor (?!%: */
  198.     short picked_up;        /* sleep from wand of sleep */
  199.     unsigned short in_use_flags;
  200.     struct obj *next_object;    /* next monster */
  201. };
  202.  
  203. typedef struct obj object;
  204.  
  205. #define INIT_HP 12
  206.  
  207. struct fight {
  208.     object *armor;
  209.     object *weapon;
  210.     object *left_ring, *right_ring;
  211.     short hp_current;
  212.     short hp_max;
  213.     short str_current;
  214.     short str_max;
  215.     object pack;
  216.     long gold;
  217.     short exp;
  218.     long exp_points;
  219.     short row, col;
  220.     short fchar;
  221.     short moves_left;
  222. };
  223.  
  224. typedef struct fight fighter;
  225.  
  226. struct dr {
  227.     short oth_room;
  228.     short oth_row,
  229.           oth_col;
  230.     short door_row,
  231.           door_col;
  232. };
  233.  
  234. typedef struct dr door;
  235.  
  236. struct rm {
  237.     char bottom_row, right_col, left_col, top_row;
  238.     door doors[4];
  239.     unsigned short is_room;
  240. };
  241.  
  242. typedef struct rm room;
  243.  
  244. #define MAXROOMS 9
  245. #define BIG_ROOM 10
  246.  
  247. #define NO_ROOM -1
  248.  
  249. #define PASSAGE -3        /* cur_room value */
  250.  
  251. #define AMULET_LEVEL 26
  252.  
  253. #define R_NOTHING    ((unsigned short) 01)
  254. #define R_ROOM        ((unsigned short) 02)
  255. #define R_MAZE        ((unsigned short) 04)
  256. #define R_DEADEND    ((unsigned short) 010)
  257. #define R_CROSS        ((unsigned short) 020)
  258.  
  259. #define MAX_EXP_LEVEL 21
  260. #define MAX_EXP 10000000L
  261. #define MAX_GOLD 900000
  262. #define MAX_ARMOR 99
  263. #define MAX_HP 800
  264. #define MAX_STRENGTH 99
  265. #define LAST_DUNGEON 99
  266.  
  267. #define STAT_LEVEL 01
  268. #define STAT_GOLD 02
  269. #define STAT_HP 04
  270. #define STAT_STRENGTH 010
  271. #define STAT_ARMOR 020
  272. #define STAT_EXP 040
  273. #define STAT_HUNGER 0100
  274. #define STAT_LABEL 0200
  275. #define STAT_ALL 0377
  276.  
  277. #define PARTY_TIME 10    /* one party somewhere in each 10 level span */
  278.  
  279. #define MAX_TRAPS 10    /* maximum traps per level */
  280.  
  281. #define HIDE_PERCENT 12
  282.  
  283. struct tr {
  284.     short trap_type;
  285.     short trap_row, trap_col;
  286. };
  287.  
  288. typedef struct tr trap;
  289.  
  290. extern fighter rogue;
  291. extern room rooms[];
  292. extern trap traps[];
  293. extern unsigned short dungeon[DROWS][DCOLS];
  294. extern object level_objects;
  295.  
  296. extern struct id id_scrolls[];
  297. extern struct id id_potions[];
  298. extern struct id id_wands[];
  299. extern struct id id_rings[];
  300. extern struct id id_weapons[];
  301. extern struct id id_armors[];
  302.  
  303. extern object mon_tab[];
  304. extern object level_monsters;
  305.  
  306. #define MONSTERS 26
  307.  
  308. #define HASTED                    01L
  309. #define SLOWED                    02L
  310. #define INVISIBLE                04L
  311. #define ASLEEP                   010L
  312. #define WAKENS                   020L
  313. #define WANDERS                   040L
  314. #define FLIES                  0100L
  315. #define FLITS                  0200L
  316. #define CAN_FLIT              0400L        /* can, but usually doesn't, flit */
  317. #define CONFUSED              01000L
  318. #define RUSTS                 02000L
  319. #define HOLDS                 04000L
  320. #define FREEZES                010000L
  321. #define STEALS_GOLD            020000L
  322. #define STEALS_ITEM            040000L
  323. #define STINGS               0100000L
  324. #define DRAINS_LIFE           0200000L
  325. #define DROPS_LEVEL           0400000L
  326. #define SEEKS_GOLD          01000000L
  327. #define FREEZING_ROGUE      02000000L
  328. #define RUST_VANISHED      04000000L
  329. #define CONFUSES         010000000L
  330. #define IMITATES         020000000L
  331. #define FLAMES             040000000L
  332. #define STATIONARY        0100000000L        /* damage will be 1,2,3,... */
  333. #define NAPPING            0200000000L        /* can't wake up for a while */
  334. #define ALREADY_MOVED    0400000000L
  335.  
  336. #define SPECIAL_HIT        (RUSTS|HOLDS|FREEZES|STEALS_GOLD|STEALS_ITEM|STINGS|DRAINS_LIFE|DROPS_LEVEL)
  337.  
  338. #define WAKE_PERCENT 45
  339. #define FLIT_PERCENT 33
  340. #define PARTY_WAKE_PERCENT 75
  341.  
  342. #define HYPOTHERMIA 1
  343. #define STARVATION 2
  344. #define POISON_DART 3
  345. #define QUIT 4
  346. #define WIN 5
  347.  
  348. #define UP 0
  349. #define UPRIGHT 1
  350. #define RIGHT 2
  351. #define RIGHTDOWN 3
  352. #define DOWN 4
  353. #define DOWNLEFT 5
  354. #define LEFT 6
  355. #define LEFTUP 7
  356. #define DIRS 8
  357.  
  358. #define ROW1 7
  359. #define ROW2 15
  360.  
  361. #define COL1 26
  362. #define COL2 52
  363.  
  364. #define MOVED 0
  365. #define MOVE_FAILED -1
  366. #define STOPPED_ON_SOMETHING -2
  367. #define CANCEL '\033'
  368. #define LIST '*'
  369.  
  370. #define HUNGRY 300
  371. #define WEAK 150
  372. #define FAINT 20
  373. #define STARVE 0
  374.  
  375. #define MIN_ROW 1
  376.  
  377. /* external routine declarations.
  378.  */
  379. char *strcpy();
  380. char *strncpy();
  381. char *strcat();
  382. char *sprintf();
  383.  
  384. char *mon_name();
  385. char *get_ench_color();
  386. char *name_of();
  387. char *md_gln();
  388. char *md_getenv();
  389. char *md_malloc();
  390. boolean is_direction();
  391. boolean mon_sees();
  392. boolean mask_pack();
  393. boolean mask_room();
  394. boolean is_digit();
  395. boolean check_hunger();
  396. boolean reg_move();
  397. boolean md_df();
  398. boolean has_been_touched();
  399. object *add_to_pack();
  400. object *alloc_object();
  401. object *get_letter_object();
  402. object *gr_monster();
  403. object *get_thrown_at_monster();
  404. object *get_zapped_monster();
  405. object *check_duplicate();
  406. object *gr_object();
  407. object *object_at();
  408. object *pick_up();
  409. struct id *get_id_table();
  410. unsigned short gr_what_is();
  411. long rrandom();
  412. long lget_number();
  413. long xxx();
  414. int byebye(), onintr(), error_save();
  415.  
  416. struct rogue_time {
  417.     short year;        /* >= 1987 */
  418.     short month;    /* 1 - 12 */
  419.     short day;        /* 1 - 31 */
  420.     short hour;        /* 0 - 23 */
  421.     short minute;    /* 0 - 59 */
  422.     short second;    /* 0 - 59 */
  423. };
  424.  
  425. #ifdef CURSES
  426. struct _win_st {
  427.     short _cury, _curx;
  428.     short _maxy, _maxx;
  429. };
  430.  
  431. typedef struct _win_st WINDOW;
  432.  
  433. extern int LINES, COLS;
  434. extern WINDOW *curscr;
  435. extern char *CL;
  436.  
  437. char *md_gdtcf();
  438.  
  439. #endif CURSES
  440.